import fetch from 'axios';
import { message } from 'antd';

export default function request(options) {

  options['withCredentials'] = true;
  const res = fetch(options).catch(function(error) {
    //错误消息
    message.error(error.response.data.message);
    return { data: { message: error.response.data.message }, code: error.response.data.code };
  }).then(function(d) {

    return d;
  });
  return res;
}
